package logic;

public class TeamCell implements Cell{
	
	private Team owner;
	private Piece piece;
	private boolean hasPiece;

	public TeamCell(Team team){
		this.owner = team;
		hasPiece = false;
	}
	
	public Team cellOwner() {
		return owner;
	}

	@Override
	public Piece getPiece() {
		return piece;
	}

	@Override
	public boolean hasPiece() {
		return hasPiece;
	}

	@Override
	public boolean putPiece(Piece piece) {
//		if((owner!=Team.NOTEAM && piece.getTeam()!=owner)) return false;
		if((owner!=Team.NOTEAM && piece.getTeam()!=owner) || hasPiece) return false;
			this.piece = piece;
		this.hasPiece = true;
		return true;
	}

	@Override
	public void removePiece() {
		piece = null;
		hasPiece = false;
	}

}
